package com.erp.util.spilt;

import sun.rmi.runtime.Log;

/**
 * @author lpy
 * 分页查询工具类
 */
public class PageUtil {
    /**
     * 当前页, 默认显示第一页
     */
    private int currentPage = 1;
    /**
     * 每页显示的行数(查询返回的行数)
     */
    private int pageCount = 8;

    /**
     * 总记录数
     */
    private long totalCount;

    /**
     * 总页数 = 总记录数 / 每页显示的行数  (+ 1)
     */
    private long totalPage;

    // 返回总页数
    public long getTotalPage() {
        if (totalCount % pageCount == 0) {
            totalPage = totalCount / pageCount;
        } else {
            totalPage = totalCount / pageCount + 1;
        }
        return totalPage;
    }
    public void setTotalPage(int totalPage) {
        this.totalPage = totalPage;
    }

    public int getCurrentPage() {
        return currentPage;
    }
    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }
    public int getPageCount() {
        return pageCount;
    }
    public void setPageCount(int pageCount) {
        this.pageCount = pageCount;
    }
    public long getTotalCount() {
        return totalCount;
    }
    public void setTotalCount(long totalCount) {
        this.totalCount = totalCount;
    }
}
